import java.util.Scanner;

/**
 * Created with IDEA
 * author:ju bai
 * Date:2021/4/24
 * Time:14:59
 **/
public class Main2 {
    /**
     * 每日一题-求最大连续bit数
     *
     * @param args
     */
    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            String s = Integer.toBinaryString(n);//转化为二进制
            String[] str = s.split("0");//将其用0分隔
            int max = 0;
            for (String value : str) {//把每一段字符串给value
                if (value.length() > max) {//统计最大长度
                    max = value.length();
                }
            }
            System.out.println(max);
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            int count = 0;
            int modCount = 0;
            while (n!=0){
                if((n&1)==1){
                    count ++;
                    modCount = Math.max(modCount,count);
                }else {
                    count=0;
                }
                n>>=1;//n左移一位
            }
            System.out.println(modCount);
        }
    }
}
